<?php 
/**
 * eBay Label Printing Program Template Cell profile Database Table Class 
 * this is a Db Table Class , It stores Pre defined cell dimentions
 * @package  eBayLabelPrinter
 * @category Models/DbTable
 * @author   Norman Dong <norman.dong@hotmail.com>
 * @version  Initial
 * @copyright LeadCasket.com
 * @link     www.leadcasket.com
 * @license  Commercial
 */
 class Model_DbTable_Template_Cellprofile extends Zend_Db_Table_Abstract 
{
	/**
	 * @var string Class Table Name
	 */
	protected $_name = 'template_cell_profile'; 
	/**
	 * Get Seller Group By ID 
	 * Not decide what to do Yet
	 * @param int $idSeller  The Seller ID
	 * @return array  Not decide what to return 
	 */	
	public function getCellProfile($cellProfileID){
		$row = $this->fetchRow('`id_template_cell_profile`='.(int)$cellProfileID);
		if(!$row){
			return false;
		}
		return $row->toArray();		
	}
	public function addCellProfile($templateProfileID,$templateProfileLpp,$topCellSpace,$leftCellSpace){

		$data = array(
				'id_template_profile' =>$templateProfileID,
				'id_lpp_template_profile'=>$templateProfileLpp,
				'space_top_cell'=>$topCellSpace,
				'space_left_cell'=>$leftCellSpace,					
		);
		$this->insert($data);		
		
	}
	public function updateCellProfile($cellProfileID,$templateProfileID,$templateProfileLpp,$topCellSpace,$leftCellSpace){
		$data = array(
				'id_template_profile' =>$templateProfileID,
				'id_lpp_template_profile'=>$templateProfileLpp,
				'space_top_cell'=>$topCellSpace,
				'space_left_cell'=>$leftCellSpace,
		);
		$this->update($data,'id_template_cell_profile ='.$cellProfileID);				
	}	
	public function deleteCellProfile($cellProfileID){
		$this->delete('id_template_cell_profile =' . $cellProfileID);
	}
	public function listCellProfile(){
		$rows = $this->fetchAll('1');
		if(empty($rows)){
			return false;
		}
		return $rows->toArray();		
	}	
	public function getCellProfileByTemplateProfile($templateProfileID){
		$rows = $this->fetchAll('id_template_profile ='.(int)$templateProfileID);
		if(empty($rows)){
			return false;
		}
		return $rows->toArray();		
	}	
				
}
?>